	{extend name="base"}
{block name="title"}
点赚金-后台管理-配送员管理
{/block}
{block name="pageName"}
注册码({$unusenum})
{/block}
{block name="pageBody"}
<!-- 一个表格 -->
<div class="btn-toolbar">
	<button class="btn btn-error" onclick="generate()">生成注册码</button>
    <button class="btn btn-success" onclick="javascript:location.reload()">刷新</button>
  <div class="btn-group">
  </div>
</div>
<div class="well">
    <table class="table">
      <thead>
        <tr>
			<th>#</th>
			<th>注册码</th>
          	<th style="width: 26px;"></th>
        </tr>
      </thead>
      <tbody id="codes">
        {volist name='codes' id='code'}
		<tr>
			<th scope="row">{$i}</th>
			<td>{$code.register_code}</td>
		</tr>
		{/volist}
      </tbody>
    </table>
</div>
<div class="pagination">
    {$codes->render()}
</div>

<!-- 进行状态修改的jQuery函数 -->
	<script>
		function generate(cash_id){
			$("#num").modal("show");
		}

		function getInfo(user_id){
			$.getJSON("{:url('userdo/getUser')}",{user_id:user_id},function(data){
				var user = data.data;
				$("#user_info input[name='user_name']").val(user.user_name);
				$("#user_info input[name='user_balance']").val(user.user_balance);
				$("#user_info input[name='user_phone']").val(user.user_phone);
				$("#user_info input[name='user_email']").val(user.user_email);
				$("#user_info").modal("show");
			})
		}
	</script>
{/block}
<!-- 一个表格结束 -->
{block name="model"}
	<div id="num" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
		<div class="modal-header">
			<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
			<h3 id="myModalLabel">注册码生成</h3>
		</div>
		<form class="form-horizontal" action="{:url('generateCode')}" method="post" enctype="multipart/form-data">
			<br>
			<input type="hidden" name="uid"><br>
			<div class="control-group">
	            <label class="control-label">生成个数</label>
	            <div class="controls">
	              <input type="number" min=1 max=100 name="num" required><br>
	        	</div>
	        </div>	
			<div class="modal-footer">
				<input type="submit" value="生成">
				<button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
			</div>
		</form>
	</div>
{/block}